import java.awt.image.BufferedImage;

/******************************************************************************
 * <p>
 * File: sprite.java
 * </p>
 * @author  Tadhg O'Sullivan, rogue, Goncalo Bastos
 * @author <a href="mailto:tadhg.osullivan@ucdconnect.ie">tadhg.osullivan@ucdconnect.ie</a>
 * @version 1.0, 2007
 * @created 22-Feb-07 5:54:57 PM
 * @revised 22-Feb-07
 * Copyright 2007 Tadhg O'Sullivan
 * <p>
 * Description: Create a sprite object with the appropriate getter and setter
 * methods
 * </p>
 *  <p>
 *  This file is part of Retribution.
 *  </p>
 *  <p>
 *  Retribution is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Retribution is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Retribution; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *  <p>
 *****************************************************************************/

public class sprite extends tileObject{
	
	protected BufferedImage image;
	protected int health;
	protected int attackStrength;
	protected int posX;
	protected int posY;
	protected boolean alive;
	protected boolean attacked;
	protected boolean moved;
	
	/**
	 * @param i The BufferedImage for the tile
	 * @param n The number used to reference the tile
	 * @param x The x coordinate of the tile
	 * @param y The y coordinate of the tile
	 * @param h The health of the sprite
	 * @param a The attack strength of the sprite
	 * @param b The boolean for whether the sprite is alive
	 */
	public sprite(BufferedImage i, int n, int x, int y, int h, int a, boolean b) {
		super(i, n, x, y);
		this.health = h;
		this.attackStrength = a;
		this.alive = true;
		this.attacked = false;
		this.moved = false;
	}

	//	 getter methods	
	/**
	 * @return health The int health of the sprite
	 */
	public int getHealth(){
		return this.health;
	}
	
	/**
	 * @return attackStrength The int attack strength
	 */
	public int getAttackStrength(){
		return attackStrength;
	}
	
	/**
	 * @return alive The boolean for whether the sprite is alive
	 */
	public boolean getLifeState(){
		return alive;
	}
	public boolean getMovedState(){
		return moved;
	}
	public boolean getAttackState(){
		return attacked;
	}
	
	// setter methods
	/**
	 * @param h The int for the health of the sprite
	 */
	public void setHealth(int h){
		this.health = h;
	}
	
	/**
	 * @param a The int fot the attack strength of the sprite
	 */
	public void setAttackStrength(int a){
		this.attackStrength = a;
	}
	public void setMovedState(boolean b){
		this.moved = b;
	}
	public void setAttackState(boolean b){
		this.attacked=b;
	}
	
	/**
	 * @param b The boolean for the sprite alive status
	 */
	public void setLifeState(boolean b){
		this.alive = b;
	}
	public void hasAttacked(boolean b,hero h,enemy e){
		this.attacked = b;
		if(h.getHealth()<0){
			h.setLifeState(false);
		}else if(e.getHealth()<0){
			e.setLifeState(false);
		}
		
	}

}
